#include "../logs/lcglog.h"
#include <unistd.h>

void test_log(const std::string& name){
    INFO("%s", "测试开始");
    lcglog::Logger::ptr logger = lcglog::LoggerManger::getInstance().getLogger(name);
    logger->debug("%s", "测试日志");
    logger->info("%s", "测试日志");
    logger->warn("%s", "测试日志");
    logger->error("%s", "测试日志");
    logger->fatal("%s", "测试日志");
    INFO("%s", "测试完毕");

}
int main()
{

    std::unique_ptr<lcglog::LoggerBuilder> builder(new lcglog::GlobalLoggerBuilder());
    builder->buildLoggerName("sync_logger");
    builder->buildLoggerLevel(lcglog::LogLevel::value::DEBUG);
    builder->buildLoggerFormatter("[%c][%f:%l][%p]%m%n");
    builder->buildLoggerType(lcglog::LoggerType::LOGGER_SYNC);
    builder->buildSink<lcglog::FileSink>("./logfile/sync.log");
    builder->buildSink<lcglog::StdoutSink>();
    builder->buildSink<lcglog::RollBySizeSink>("./logfile/sync-roll-by-size", 1024*1024);
    builder->build();
    test_log("sync_logger");
    
    return 0;
}